package 蒙特卡洛;

/**
 * @ClassName: mtkl
 * @Auther: Drawin
 * @Date: 2021/10/12 22:36
 * @Description:
 */

public class mtkl {
    public static void main(String[] args) {
        final int N=100000;
        int sum=0;
        for(int i=1;i<N;i++){
            double x=Math.random();
            double y=Math.random();
            if((x*x+y*y)<1)
                sum++;
        }
        System.out.println("pi="+(double)4*sum/N);
    }
}
